package logic

import (
	"cart_srv/model/redis"
	"context"

	"cart_srv/cart"
	"cart_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type CartClearLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewCartClearLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CartClearLogic {
	return &CartClearLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *CartClearLogic) CartClear(in *cart.CartCrealRequest) (*cart.CartCrealResponse, error) {
	// todo: add your logic here and delete this line
	redis.CartDel(int(in.UserId))
	return &cart.CartCrealResponse{Success: true}, nil
}
